<template>
    <view class="card-title flex justify-between p-4">
        <view class="text">{{ text }}</view>
        <view>
            <u-text
                suffixIcon="arrow-right"
                color="#9ca3af"
                iconStyle="color:#9ca3af"
                size="12"
                text="查看更多"
                @click="itemClick"
            ></u-text>
        </view>
    </view>
</template>

<script setup lang="ts">
import { useRoute } from "@/hooks/useRoute";

const props = defineProps<{
    text: string;
    link: string;
}>();

const itemClick = () => {
    let link = props.link || "";
    if (link) useRoute().jumpTo({ url: link });
};
</script>

<style lang="scss" scoped>
.card-title {
    border-bottom: 1px solid #f8f8f8;
    .text {
        font-size: 18px;
        font-weight: 300;
        line-height: 24rpx;
    }
    .link {
        font-size: 10px;
        line-height: 24rpx;
    }
}
</style>
